package com.wwh.spring;

import com.wwh.spring.aop.Calculator;
import com.wwh.spring.component.UserAction;
import com.wwh.spring.component.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Albert
 * @date 2024/8/27-18:39
 * @describe
 */
public class AppMain {
    public static void main(String[] args) {
        ApplicationContext ioc = new ClassPathXmlApplicationContext("beans.xml");

        UserAction userAction = (UserAction) ioc.getBean("userAction");
        UserService userService = ioc.getBean(UserService.class);

        System.out.println("userAction = " + userAction);
        System.out.println(AppMain.class.getClassLoader().getResource(""));

        userService.m1();

        Calculator calculator = ioc.getBean(Calculator.class);
        calculator.getSum(10.0f, 2.0f);
        calculator.getSub(10.0f, 2.0f);
        System.out.println("calculator = " + calculator.getClass());
    }
}
